#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 10005;

int n, m;
int np[N], primes[N], tot;
int mo[N];
int cnt[N];
ll C(int n) {
  if (n < 4) return 0;
  ll ans = 1;
  rep(i, 0, 3) ans *= (n - i);
  rep(i, 1, 4) ans /= i;
  return ans;
}
void init(int n) {
  np[1] = 1;
  mo[1] = 1;
  rep(i, 2, n) {
    if (!np[i]) {
      primes[++tot] = i;
      mo[i] = -1;
    }
    rep(j, 1, tot) {
      ll k = 1ll * primes[j] * i;
      if (k > n) break;
      np[k] = 1;
      mo[k] = mo[i] * (i % primes[j] == 0 ? 0 : -1);
      if (i % primes[j] == 0) break;
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  init(10000);
  while (cin >> n) {
    memset(cnt, 0, sizeof(cnt));
    int mx = 0;
    rep(i, 1, n) {
      int x;
      cin >> x;
      mx = max(mx, x);
      for (int j = 1; j * j <= x; j++) {
        if (x % j == 0) {
          int k = x / j;
          cnt[j]++;
          if (k != j) cnt[k]++;
        }
      }
    }
    ll ans = 0;
    rep(i, 1, mx) { ans += mo[i] * C(cnt[i]); }
    cout << ans << endl;
  }
  return 0;
}